<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('区域管理')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    select {
        padding-top: 3px !important;
    }

    .select-list {
        margin-top: 5px !important;
    }

    .select-list li p {
        width: 20px !important;
    }

</style>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="region-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>年：</p>
                                <select id="year" name="year" class="form-control select2">
                                    <option value="">请选择</option>
                                    <option th:each="year : ${year}" th:text="${year.name+'年'}"
                                            th:value="${year.name}"></option>
                                </select>
                            </li>
                            <li>
                                <p>月：</p>
                                <select id="month" name="month" class="form-control select2">
                                    <option value="">请选择</option>
                                    <option th:each="month : ${month}" th:text="${month.name+'月'}"
                                            th:value="${month.name}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                            <li style="float: right;">
                                <a class="btn btn-warning" onclick="$.table.exportData('平均单价')">
                                    <i class="fa fa-download"></i> 导出
                                </a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">
    var prefix = ctx + "costSummary";
    $(function () {
        var options = {
            uniqueId: 'codeId',
            url: prefix + "/findCurrentUnivalent",
            exportUrl: prefix + "/exportCurrentUnivalent",
            modalName: "单价",
            columns: [
                {
                    field: 'codeNum',
                    title: '编码编号'
                },
                {
                    field: 'codeName',
                    title: '编码名称'
                },
                {
                    field: 'codeUnit',
                    title: '单位'
                },
                {
                    field: 'currentUnivalent',
                    title: '平均单价'
                }
            ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>